#include<iostream>
#include<algorithm>
#include<string.h>
#include<vector>
using namespace std;
int dp[610][6010][2];
int main()
{
	int n, m;
	while (cin >> n >> m)
	{
		int w[610];
		for (int i = 1; i <= n; i++)
		{
			cin >> w[n+1-i];
		}
		memset(dp, 0, sizeof(dp));
		for (int i = 1; i <= n; i++)
		{
			for (int j = 0; j <=m ; j++)
			{
				if (j >= w[i])
				{
					int x = dp[i - 1][j][0], y = dp[i - 1][j - w[i]][0] + 1;
					if (x > y)
					{
						dp[i][j][0] = x;
						dp[i][j][1] = dp[i - 1][j][1];
					}
					else if(x<y)
					{
						dp[i][j][0] = y;
						dp[i][j][1]= dp[i - 1][j - w[i]][1] + w[i];
					}
					else
					{
						dp[i][j][0] = y;
						dp[i][j][1] = max(dp[i - 1][j][1], dp[i - 1][j - w[i]][1]+w[i]);
					}
				}
				else
				{
					dp[i][j][0] = dp[i - 1][j][0];
					dp[i][j][1] = dp[i - 1][j][1];
				}
					
			}
		}
		cout << dp[n][m][0]<<' '<<dp[n][m][1] << endl;
		int path[605],k=0;
		int j = dp[n][m][1],i=n;
		while (i)
		{
			if (dp[i][j][0] == dp[i - 1][j - w[i]][0] + 1 && dp[i][j][1] == dp[i - 1][j - w[i]][1] + w[i])
			{
				j -= w[i];
				path[k++] = w[i];
			}
			i--;
		}
		for (k = 0; k <= dp[n][m][0]-1; k++)
		{
			if (k != 0) cout << ' ';
			cout << path[k];
		}
		cout << endl;

	}
	return 0;
}